package com.zhouyu.aop;

import com.zhouyu.aop.service.OrderInterface;
import com.zhouyu.aop.service.OrderService;
import com.zhouyu.service.UserService;
import org.springframework.cglib.proxy.*;

import java.lang.reflect.Method;

/**
 * @author mimao funfind@yeah.net
 * @date ${{
 */
public class TestJDK {

	public static void main(String[] args) {

		OrderService target = new OrderService();

		OrderInterface o = (OrderInterface)Proxy.newProxyInstance(TestJDK.class.getClassLoader(), new Class[]{OrderInterface.class}, new InvocationHandler() {
			@Override
			public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
				System.out.println("before");
				method.invoke(target,objects);
				System.out.println("after");
				return null;
			}
		});
		o.test();
	}
}
